package com.czy.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author czy
 * @date 2022-4-4 23:19
 */
@Data
public class MyUserDetails implements UserDetails {
    private Long id;
    private String username;
    private String password;
    private String nickname;
    private boolean enabled;
    private List<Map<String,String>> roles;
    private String email;
    private String userface;

    // 获取角色权限
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    // 获取密码
    @Override
    public String getPassword() {
        return this.password;
    }

    // 获取用户名
    @Override
    public String getUsername() {
        return this.username;
    }

    // 用户账号是否过期
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    // 用户账号是否被锁定
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    // 用户密码是否过期
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    // 用户是否可用
    @Override
    public boolean isEnabled() {
        return true;
    }
}
